package com.clqteam.controller;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import com.clqteam.model.Employee;
import com.clqteam.service.DailyService;
import com.clqteam.service.DeleteVIPService;
import com.clqteam.serviceimpl.DailyServiceImpl;
import com.clqteam.serviceimpl.DeleteVIPServiceImpl;
/**
 * VIP删除功能的controller
 * @author Administrator
 *LXG
 */
public class DeleteVIPLXGController extends HttpServlet{
	DeleteVIPService dvs=new DeleteVIPServiceImpl();
	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		doPost(req, resp);
	}
	
	@Override
	protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		req.setCharacterEncoding("utf8");
		resp.setCharacterEncoding("utf8");
		//引用日志
	    DailyService ds=new DailyServiceImpl();
		HttpSession session=req.getSession();
		Employee e=(Employee) session.getAttribute("employee");
		int eId=e.geteId();
		String eName=e.geteName();
		String function="删除会员信息";
		
		String vid=req.getParameter("vId");
		int vId=Integer.parseInt(vid);
		boolean b=dvs.deleteVIPByVid(vId);
		PrintWriter pw=resp.getWriter();
		if(b=true){
			ds.functionDaily(function, eId, eName);
			pw.write("1");
		}else{
			pw.write("0");
		}
		pw.flush();
		pw.close();
	}
}
